package com.ljm.boot.retry.callback;

import lombok.extern.slf4j.Slf4j;
import org.springframework.retry.RecoveryCallback;
import org.springframework.retry.RetryContext;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CustomRecoveryCallback implements RecoveryCallback<String> {
    @Override
    public String recover(RetryContext retryContext) {
        log.error("fallback,retryCount:{},error msg:{}",retryContext.getRetryCount(),retryContext.getLastThrowable().getMessage());
        return "fallback";
    }
}